﻿using System.ComponentModel;
using System.Windows.Controls;
using System.Windows.Navigation;
using System;
using OpenLightGroup.Common.ApplicationServices;
using OpenLightGroup.Common.ApplicationServices.HealthReportingProxy;

namespace Examples
{
    public partial class Home : Page
    {
        public Home()
        {
            this.InitializeComponent();
        }

        // Executes when the user navigates to this page.
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            EventLogger.LogInformation("information from client");

            var healthAgent = new HealthReportingAgent();
            
            this.EventsListBox.DataContext = healthAgent;

            if(!DesignerProperties.IsInDesignTool)
                healthAgent.StartPolling();


            //reportService.GetEventsCompleted += new EventHandler<GetEventsCompletedEventArgs>(reportService_GetEventsCompleted);
            //reportService.GetEventsAsync(0, 25);

            

            //throw new Exception("Top Level", new InvalidOperationException ( "Client POO" ) );
        }

        //void reportService_GetEventsCompleted(object sender, GetEventsCompletedEventArgs e)
        //{
        //    var x = e.Result;
        //}
    }
}